﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;

namespace BHair.Report
{
    public partial class frmxqtab : WeifenLuo.WinFormsUI.Docking.DockContent
    {
        public frmxqtab()
        {
            InitializeComponent();
        }
        string constr = ConfigurationManager.ConnectionStrings["BHair.Properties.Settings.BHairDBConnectionString"].ConnectionString;
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != string.Empty)
            {
                SqlConnection conn = new SqlConnection(constr);
                conn.Open();
                string sql = string.Format("SELECT *  FROM [会员续期] where 卡号='{0}'", textBox1.Text);
                SqlDataAdapter sda = new SqlDataAdapter(sql, conn);
                DataTable dt = new DataTable();
                sda.Fill(dt);
                dataGridView1.DataSource = dt;
                conn.Close();
            }
            else
            {
                SqlConnection conn = new SqlConnection(constr);
                conn.Open();
                string sql ="SELECT *  FROM [会员续期] ";
                SqlDataAdapter sda = new SqlDataAdapter(sql, conn);
                DataTable dt = new DataTable();
                sda.Fill(dt);
                dataGridView1.DataSource = dt;
                conn.Close();
            }

        }
    }
}
